﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Class_KetNoi
{
  public  class KetNoi_ChuyenCongTac:KetNoiCoSoDuLieu
    {
      public void them_ChuyenConngTac(string @MaNV,string @NgayChuyen,string @MaCVCu,string @MaCVMoi,string @MaPBCu,string @MaPBMoi)
      {
          SqlCommand cmd = new SqlCommand("dbo.insert_ChuyenCongTac", cnn);
          cmd.CommandType = CommandType.StoredProcedure;
          SqlParameter  p = new SqlParameter("@MaNV", Convert.ToInt32(MaNV));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@NgayChuyen",Convert.ToDateTime(NgayChuyen));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@MaCVCu",Convert.ToInt32(MaCVCu));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@MaCVMoi",Convert.ToInt32(MaCVMoi));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@MaPBCu",Convert.ToInt32(MaPBCu));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@MaPBMoi", Convert.ToInt32(MaPBMoi));
          cmd.Parameters.Add(p);
          cmd.ExecuteNonQuery();
      }
      public void sua_ChuyenConngTac(string @MaChuyen, string @MaNV, string @NgayChuyen, string @MaCVCu, string @MaCVMoi, string @MaPBCu, string @MaPBMoi)
      {
          SqlCommand cmd = new SqlCommand("dbo.update_ChuyenCongTac", cnn);
          cmd.CommandType = CommandType.StoredProcedure;
          SqlParameter p = new SqlParameter("@MaChuyen",MaChuyen);
          cmd.Parameters.Add(p);
          p = new SqlParameter("@MaNV", Convert.ToInt32(MaNV));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@NgayChuyen", Convert.ToDateTime(NgayChuyen));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@MaCVCu", Convert.ToInt32(MaCVCu));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@MaCVMoi", Convert.ToInt32(MaCVMoi));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@MaPBCu", Convert.ToInt32(MaPBCu));
          cmd.Parameters.Add(p);
          p = new SqlParameter("@MaPBMoi", Convert.ToInt32(MaPBMoi));
          cmd.Parameters.Add(p);
          cmd.ExecuteNonQuery();
      }
      public void xoa_ChuyenConngTac(string @MaChuyen)
      {
          SqlCommand cmd = new SqlCommand("dbo.delete_ChuyenCongTac", cnn);
          cmd.CommandType = CommandType.StoredProcedure;
          SqlParameter p = new SqlParameter("@MaChuyen",MaChuyen);
          cmd.Parameters.Add(p);
          cmd.ExecuteNonQuery();
      }

    }
}
